(function(){
	var Detail=window.Detail=function(){
		this.getFunc(this,Detail._objParent)();
		this.btnTrans=this.$('#btnTrans');
		if(this.btnTrans){
			this.bindEvent(this.btnTrans,'click',this.getFunc(this,this.showTerminal));
		}
	}.extend(Base);
	pt=Detail.prototype;
	pt.showTerminal=function(){
		this.strEpKey=this.getChkboxesValue('chkEp',true);
		if(this.strEpKey.length>0){
			this.ajax({
				url:'/terminal/',
				onSuccess:this.getFunc(this,this.drawTerminalList),
			});
		}else{
			Dialog.alert({
				title:'Drama',
				alertstr:'请选择剧集',
				btnstr:'确定'
			});
		}
	},pt.drawTerminalList=function(p_jsnTerminalList){
		p_jsnTerminalList=eval.call(window,p_jsnTerminalList);
		var intLenth=p_jsnTerminalList.length;
		this.objForm=document.createElement('form');
		this.setAttribute(this.objForm,'method','post');
		this.setAttribute(this.objForm,'action','');
		this.setAttribute(this.objForm,'name','frmTerminal');
		this.setAttribute(this.objForm,'id','frmTerminal');
		this.setAttribute(this.objForm,'enctype','application/x-www-form-urlencoded');
		var dropList=document.createElement('select');
		this.appendEle(this.objForm,dropList);
		this.setAttribute(dropList,'name','dropList');
		this.setProps(dropList,{
			style:{
				width:'80%'
			}
		});
		for( var i=0;i<intLenth;++i){
			dropList.options[i]=new Option(p_jsnTerminalList[i]['name'],p_jsnTerminalList[i]['code']);
		}
		var hidAction=document.createElement('input');
		this.setAttribute(hidAction,'name','hidAction');
		this.setAttribute(hidAction,'type','hidden');
		this.setAttribute(hidAction,'value','send');
		this.appendEle(this.objForm,hidAction);
		var hidFileKey=document.createElement('input');
		this.setAttribute(hidFileKey,'name','hidFileKey');
		this.setAttribute(hidFileKey,'type','hidden');
		this.setAttribute(hidFileKey,'value',this.strEpKey);
		this.appendEle(this.objForm,hidFileKey);
		Dialog.confirm({
			title:'Drama',
			confirmstr:this.objForm.outerHTML,
			yesbtnstr:'开始',
			nobtnstr:'取消',
			yesCallBack:this.sendEp,
			yesObject:this
		});
	},pt.sendEp=function(){
		//this.objForm.style.display="none";
		//document.getElementById('frmTerminal').submit();
		this.$('#frmTerminal').submit();
		//alert()
	}
})();